package team3132.subsystems;

import edu.wpi.first.wpilibj.Compressor;
import edu.wpi.first.wpilibj.command.Subsystem;
import team3132.utils.Trace;
import team3132.utils.Value;

/**
 * Compressor, powers the cylinders for the feeder arms and catapult
 */
public class CompressorSubsystem extends Subsystem {

  private final Compressor compressor;
  private final Trace trace;

  public CompressorSubsystem(Value compressorSwitchChannel, Value compressorRelayChannel) {
    compressor = new Compressor(
            compressorSwitchChannel.getIntValue(), compressorRelayChannel.getIntValue());
    trace = new Trace(this);
  }

  public void startCompressor() {
    trace.trace("Starting compressor");
    compressor.start();
  }

  public void stopCompressor() {
    trace.trace("Stopping compressor");
    compressor.stop();
  }

  //Used for turning off and on the pressure and prevent overpressure
  public boolean isUpToPressure() {
    return compressor.getPressureSwitchValue();
  }

  public void initDefaultCommand() {
  }
}
